<!DOCTYPE html>
<html>
<head>
<title>添加#(useName)</title>
#[[#include("../include/common.html")]]#
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>添加#(useName)</h5>
            </div>
           <form id="inputForm" action="save" method="post">
	            <div class="ibox-content">
	                <div class="form-horizontal clearfix">
	                	#for(field : fields)
               			<div class="form-group">
	                        <label class="col-sm-3 control-label">#(field.title)：</label>
	                		#if(field.type=="text")
	                        <div class="col-sm-3">
	                            <input class="form-control" type="text" name="#(field.name)">
	                        </div>
	                		#else if(field.type=="textarea")
                            <div class="col-sm-8">
                                <textarea class="form-control" style="height: 250px;" name="#(field.name)"></textarea>
                            </div>
	                		#else if(field.type=="editor")
	                		<div class="col-sm-8">
	                           <textarea id="#(field.name)" name="#(field.name)" class="ibox-content no-padding" style="height: 250px;"></textarea>
	                        </div>
	                		#end
	                    </div>
	                	#end
	                </div>
	            </div>
	            <div class="modal-footer col-sm-3 col-sm-offset-2">
	                <button type="submit" class="btn btn-w-m btn-primary">确定</button>
	                <button type="button" class="btn btn-w-m btn-default" onclick="history.back(); return false;">取消</button>
	            </div>
            </form>
        </div>
    </div>
</body>
</html>
<script type="text/javascript">
$().ready(function() {

	var $inputForm = $("#inputForm");
	
	#for(field : fields)#if(field.type=="editor")var $#(field.name) = $("#(field.name)");
	$#(field.name).editor();
	#else if(field.type=="file")var $filePicker = $("#filePicker");
	$filePicker.uploader();#end#end
		
    // 表单验证
    $inputForm.validate({
        rules: {
        	#set(rulesIndex=0)#for(field : fields)#if(field.isRequired)#if(rulesIndex>0),
        	#end#set(rulesIndex=rulesIndex+1)#(field.name): "required"#end#end 
        }
    });	
});
</script>
